--[[
 -- *名称:main
 -- *描述:文件开始类
 -- *版权:Copyright © 2016-2018 深圳市三只小熊科技有限公司 版权所有
 -- *作者:Administrator
 -- *创建日期:2017-11-07
 -- *修改日期:2017-11-07
 -- @return [description]
 ]]
basePath = ""
require("json")
require(basePath.. "util/dump");
PokerGameConstant = require(basePath.. "constant/pokergameconstant");
require(basePath.."pokercore/functions");
pokercore = require(basePath.. "pokercore/object");
CardShape = require(basePath.. "domain/cardshape");
DdzCardType = require(basePath.. "domain/ddzcardtype");
DdzCardTypes = require(basePath.. "domain/ddzcardtypes");
PokerUtil =  require(basePath.."util/pokerutil");
DdzTypeUtil = require(basePath.."util/ddztypeutil");
ServerInterface = require(basePath.."pokerailogic_server");

--require(basePath .. "test");
local card1 = "{\"cardList\":[{\"shape\":0,\"value\":3,\"number\":3},{\"shape\":1,\"value\":3,\"number\":3},{\"shape\":2,\"value\":3,\"number\":3}],\"cardtype\":1}";
local card2 = "{\"cardList\":[{\"shape\":0,\"value\":5,\"number\":5}],\"cardtype\":1}";
--local card2 = "{\"cardList\":[{\"shape\":0,\"value\":3,\"number\":3},{\"shape\":1,\"value\":3,\"number\":3}],\"cardtype\":1}";
local str = "{\"cmd\":\"compare\",\"cardarray\":[" .. card1 .. ",".. card2 .. "]}";

--全局方法
function invoker(str)
   local msg = json.decode(str) ; --解析数据
   if msg.cmd  == "compare" then
   	  return json.encode(ServerInterface.compare(msg));
   end
end

print(invoker(str));

local testData = {
  	[1] = {
        ["number"] = 3,
        ["shape"] = 0,
        ["value"] = 3,
    },
    [2] = {
        ["number"] = 3,
        ["shape"] = 1,
        ["value"] = 3,
    },
    [3] = {
        ["number"] = 3,
        ["shape"] = 2,
        ["value"] = 3,
    },
    [4] = {
        ["number"] = 3,
        ["shape"] = 3,
        ["value"] = 3,
    },
    [5] = {
        ["number"] = 4,
        ["shape"] = 0,
        ["value"] = 4,
    },
    [6] = {
        ["number"] = 4,
        ["shape"] = 1,
        ["value"] = 4,
    },
    [7] = {
        ["number"] = 5,
        ["shape"] = 0,
        ["value"] = 5,
    },
    [8] = {
        ["number"] = 8,
        ["shape"] = 1,
        ["value"] = 8,
    },
    [9] = {
        ["number"] = 1,
        ["shape"] = 0,
        ["value"] = 14,
    },
    [10] = {
        ["number"] = 2,
        ["shape"] = 0,
        ["value"] = 10015,
    },
    [11] = {
        ["number"] = 16,
        ["shape"] = 4,
        ["value"] = 16,
    },
    [12] = {
        ["number"] = 17,
        ["shape"] = 5,
        ["value"] = 17,
    },
    [13] = {
        ["number"] = 12,
        ["shape"] = 0,
        ["value"] = 12,
    },
    [14] = {
        ["number"] = 13,
        ["shape"] = 0,
        ["value"] = 13,
    }
}

--dump(ServerInterface._getCardsListTips(nil, testData),"dddd");
--dump(testData,"testData->");
--ServerInterface._getCardsListTips(nil, testData);

--local result = ServerInterface._getCardsListTips(nil, testData);
--local tipCount = 0;
--for i,v in ipairs(result) do
--	tipCount = tipCount + 1;
--	print(v:getResult());
--	for j,v2 in ipairs(v:getCardList()) do
--		--print(j,v2);
--	end
--end
--print("tipCount:" .. tipCount);